package com.zw.pm.module.integrate.schedule;

import com.zw.pm.base.BaseController;
import com.zw.pm.common.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Description: 完成时间查询 控制层
 *
 * @Author: China.sgl
 * @Date: 2019/9/16 09:11
 */
@Slf4j
@Controller
@RequestMapping("/integrate/schedule")
public class ScheduleController extends BaseController {

    @Autowired
    private ScheduleService scheduleService;

    /**
     * 完成时间页面
     * 
     * @return 页面路径
     */
    @GetMapping
    @RequiresPermissions({"integrate:schedule"})
    public String project() {
        return "integrate/schedule/page";
    }

    /**
     * 列表
     * 
     * @param scheduleModel 查询条件
     * @return list
     */
    @ResponseBody
    @PostMapping("/list")
    @RequiresPermissions({"integrate:schedule"})
    public JsonResult list(ScheduleModel scheduleModel) {
        long start = System.currentTimeMillis();
        startPage();
        List<ScheduleModel> list = scheduleService.findProject(scheduleModel);
        log.debug("完成时间列表查询用时（毫秒）" + (System.currentTimeMillis() - start));
        return jsonResult(list);
    }

}
